Add additional accessability relations. (#141804, Padraig O'Briain)
authorMatthias Clasen <maclas@gmx.de>
Thu, 22 Jul 2004 05:27:18 +0000 (05:27 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 22 Jul 2004 05:27:18 +0000 (05:27 +0000)
Thu Jul 22 01:21:28 2004  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkfontsel.c (gtk_font_selection_init): Add additional
accessability relations.  (#141804,  Padraig O'Briain)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfontsel.c

index 9ec7927dbdece36fbbca5a538f2fd0a024f4250e..84891a89bce275a57a71f5609b0fd399a625d57e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jul 22 01:21:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_init): Add additional
+       accessability relations.  (#141804,  Padraig O'Briain)
+
 Thu Jul 22 01:16:23 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcombobox.c: Avoid some warnings.
index 9ec7927dbdece36fbbca5a538f2fd0a024f4250e..84891a89bce275a57a71f5609b0fd399a625d57e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Jul 22 01:21:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_init): Add additional
+       accessability relations.  (#141804,  Padraig O'Briain)
+
 Thu Jul 22 01:16:23 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcombobox.c: Avoid some warnings.
index 9ec7927dbdece36fbbca5a538f2fd0a024f4250e..84891a89bce275a57a71f5609b0fd399a625d57e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Jul 22 01:21:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_init): Add additional
+       accessability relations.  (#141804,  Padraig O'Briain)
+
 Thu Jul 22 01:16:23 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcombobox.c: Avoid some warnings.
index 9ec7927dbdece36fbbca5a538f2fd0a024f4250e..84891a89bce275a57a71f5609b0fd399a625d57e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Jul 22 01:21:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkfontsel.c (gtk_font_selection_init): Add additional
+       accessability relations.  (#141804,  Padraig O'Briain)
+
 Thu Jul 22 01:16:23 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkcombobox.c: Avoid some warnings.
index 64c7b312d0888821797462c57a8b610848ee5a4e..06890deb3208c2e2a86a38e23e3c05a727a12703 100644 (file)
@@ -34,6 +34,8 @@
 #include <glib/gprintf.h>
 #include <string.h>
 
+#include <atk/atk.h>
+
 #include "gdk/gdk.h"
 #include "gdk/gdkkeysyms.h"
 
@@ -55,6 +57,7 @@
 #include "gtkvbox.h"
 #include "gtkscrolledwindow.h"
 #include "gtkintl.h"
+#include "gtkaccessible.h"
 
 /* We don't enable the font and style entries because they don't add
  * much in terms of visible effect and have a weird effect on keynav.
@@ -313,6 +316,7 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
   GtkListStore *model;
   GtkTreeViewColumn *column;
   GList *focus_chain = NULL;
+  AtkObject *atk_obj;
 
   gtk_widget_push_composite_child ();
 
@@ -494,6 +498,50 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
 
   g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list)), "changed",
                    G_CALLBACK (gtk_font_selection_select_size), fontsel);
+  atk_obj = gtk_widget_get_accessible (fontsel->size_list);
+  if (GTK_IS_ACCESSIBLE (atk_obj))
+    {
+      /* Accessibility support is enabled.
+       * Make the label ATK_RELATON_LABEL_FOR for the size list as well.
+       */
+      AtkObject *atk_label;
+      AtkRelationSet *relation_set;
+      AtkRelation *relation;
+      AtkObject *obj_array[1];
+      GPtrArray *array;
+
+      atk_label = gtk_widget_get_accessible (label);
+      relation_set = atk_object_ref_relation_set (atk_obj);
+      relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_LABELLED_BY);
+      if (relation)
+        {
+          array = atk_relation_get_target (relation);
+          g_ptr_array_add (array, atk_label);
+        }
+      else 
+        {
+          obj_array[0] = atk_label;
+          relation = atk_relation_new (obj_array, 1, ATK_RELATION_LABELLED_BY);
+          atk_relation_set_add (relation_set, relation);
+        }
+      g_object_unref (relation_set);
+
+      relation_set = atk_object_ref_relation_set (atk_label);
+      relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_LABEL_FOR);
+      if (relation)
+        {
+          array = atk_relation_get_target (relation);
+          g_ptr_array_add (array, atk_obj);
+        }
+      else 
+        {
+          obj_array[0] = atk_obj;
+          relation = atk_relation_new (obj_array, 1, ATK_RELATION_LABEL_FOR);
+          atk_relation_set_add (relation_set, relation);
+        }
+      g_object_unref (relation_set);
+    }    
+      
 
   /* create the text entry widget */
   label = gtk_label_new_with_mnemonic (_("_Preview:"));